

#ifndef FIFO_H__
#define FIFO_H__

#include <stdint.h>
#include <stdbool.h>

typedef struct
{
    uint8_t* const pdata;
    uint32_t wp;
    uint32_t rp;
    uint32_t mask; 
}fifob_t; // for fifo byte 

typedef struct
{
    uint8_t* pdata; 
    uint32_t count; 
}fifob_dequeue_t;

#define FIFOB_CONFIG(BUFF, MASK)      {.pdata = BUFF, .mask = MASK }


void fifob_enqueue(fifob_t* f, uint8_t byte);

uint8_t fifob_dequeue(fifob_t* f);

void fifob_enqueue_data(fifob_t* f, uint8_t* pdata, uint16_t bytes_to_write);

void fifob_dequeue_data(fifob_t* f, fifob_dequeue_t* d);

uint32_t fifob_get_count(fifob_t* f); 

bool fifob_is_empty(fifob_t* f);

void fifob_reset(fifob_t* f); 


#endif 

